<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
	<meta charset="utf-8" />
    <title>&copy;云多科技</title>

	<meta name="description" content="Draggabble Widget Boxes &amp; Containers" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

	<!-- bootstrap & fontawesome -->
	<link rel="stylesheet" href="assets/weui/dist/style/weui.min.css" />
	<!-- ace styles -->
	<link rel="stylesheet" href="assets/css/ace.css" class="ace-main-stylesheet" id="main-ace-style" />

</head>

<body class="no-skin">
	<div class="weui_cells">
		<div class="weui_cell">
			<div class="weui_cell_bd weui_cell_primary">
				<p>客户</p>
			</div>
			<div class="weui_cell_ft"><p id="clientname_div" ><span th:text="${clientname}"/></p></div>
		</div>

		<div class="weui_cell">
			<div class="weui_cell_bd weui_cell_primary">
				<p>客户地址</p>
			</div>
			<div class="weui_cell_ft"><p id="clientaddr_div"><span th:text="${clientaddress}"/></p></div>
		</div>
		<!--<div class="weui_cell">
			<div class="weui_cell_bd weui_cell_primary">
				<p>客户负责人</p>
			</div>
			<div class="weui_cell_ft"><span th:text="${clientprojectmgr}"/></div>
		</div>-->
		<div class="weui_cell">
			<div class="weui_cell_bd weui_cell_primary">
				<p>项目负责人</p>
			</div>
			<div class="weui_cell_ft"><p id="projectname_div"><span th:text="${projectmanager}"/></p></div>
		</div>
		<!--<div class="weui_cell">
			<div class="weui_cell_bd weui_cell_primary">
				<p>负责人电话</p>
			</div>
			<div class="weui_cell_ft"><span th:text="${projectmanagerphone}"/></div>
		</div>-->
		<div class="weui_cell">
			<div class="weui_cell_bd weui_cell_primary">
			<p>优先级</p>
			</div>
			<div class="weui_cell_ft"><span th:text="${projectpriority}"/></div>
		</div>


		<!--<div class="weui_cell">-->
			<!--<div class="weui_cell_bd weui_cell_primary">-->
				<!--<p>任务类型</p>-->
			<!--</div>-->
			<!--<div class="weui_cell_ft"><span th:text="${tasktype}"/></div>-->
		<!--</div>-->
		<div class="weui_cell">
			<div class="weui_cell_bd weui_cell_primary">
				<p>状态</p>
			</div>
			<div class="weui_cell_ft"><span th:text="${taskstatus}"/></div>
		</div>
		<div class="weui_cell">
			<div class="weui_cell_bd weui_cell_primary">
				<p>故障描述</p>
			</div>
			<div class="weui_cell_ft"><p id="issuedesc_div"><span th:text="${issuedesc}"/></p></div>
		</div>
		<div class="weui_cell">
			<div class="weui_cell_bd weui_cell_primary">
				<p>派遣员工</p>
			</div>
			<div class="weui_cell_ft"><span th:text="${assignee}"/></div>
		</div>

		<div class="weui_cell">
			<div class="weui_cell_bd weui_cell_primary">
				<p>上门日期</p>
			</div>
			<div class="weui_cell_ft"><span th:text="${arrivaldate}"/></div>
		</div>
		<div class="weui_cell">
			<div class="weui_cell_bd weui_cell_primary">
				<p>预约时间</p>
			</div>
			<div class="weui_cell_ft"><span th:text="${plantime}"/></div>
		</div>
		
		<div class="weui_cell">
			<div class="weui_cell_bd weui_cell_primary">
				<p>签到状态</p>
			</div>
			<div  class="weui_cell_ft">
				<p id="checkinstatus"><span th:text="${arrivalcheckin}"/></p>
			</div>
		</div>
	</div>
	<p id="eventid_div" style="display: none" ><span th:text="${eventid}"/></p>
	<div class="space"></div>
	<button id="checkin_btn" style="display: none" class="weui_btn weui_btn_primary">签到</button>
	<div class="space"></div>

</body>
<script src="assets/js/jquery.js"></script>
<script  type="text/javascript">
	function InitArrivalStatus() {
		if ($('#checkinstatus').text() == "yes") {
			checkinBtnHide();
		}
		else{
			checkinBtnShow();
		}

	}
	function refineLongCell(fulltext){
//		alert(fulltext);
		FIXLEN = 16+stringLenCalc(fulltext);
		remaining = fulltext;
//		alert(remaining);
		var ret_str="";
		while (remaining.length>FIXLEN){
			group1 = remaining.substr(0, FIXLEN);
			remaining = remaining.substr(FIXLEN);
			ret_str = ret_str.concat("<p>"+group1+"</p>");
		}
//		alert(ret_str);
		return ret_str.concat("<p>"+remaining+"</p>");
	}
	function stringLenCalc(fulltext){
		var count=0;
		if (fulltext.indexOf("(")!= -1 ){
			count++;
		}
		if (fulltext.indexOf(")")!= -1){
			count++;
		}
		return count;
	}
	function checkinBtnShow(){
		$("#checkinstatus").html("未签到");
		$("#checkin_btn").show();
	}
	function checkinBtnHide(){
		$("#checkinstatus").html("已签到");
		$("#checkin_btn").hide();
	}
	$(document).ready(function(){
		InitArrivalStatus();
		$("#clientname_div").html(refineLongCell($("#clientname_div").text()));
		$("#clientaddr_div").html(refineLongCell($("#clientaddr_div").text()));
		$("#issuedesc_div").html(refineLongCell($("#issuedesc_div").text()));
		$("#projectname_div").html(refineLongCell($("#projectname_div").text()));

		$("#checkin_btn").click(function(){
			_eventid=$("#eventid_div").text();
			$.ajax({
				url: "ajaxcheckin",
				type: "POST",
				data: {eventid: _eventid},
				dataType: "json",
				async: false,
				success: function(data){
					if (data.retcode == 0){
						checkinBtnHide();
//						$("#arrivetime").html(data.checkintime);
					}
					else{
						checkinBtnShow();
					}
				}
			});
		});
	});
</script>
</html>
